<%% @heading = "<%= plural_name.capitalize %>" %>
<h1><%%= @heading %></h1>

<%%= link_to image_tag('novo.png') +' Cadastrar', :action => 'novo<%= controller_class_name %>', :page => @<%= singular_name %>_pages.current.to_i %>&nbsp;&nbsp;&nbsp;

<br><br>

<%% if @<%= plural_name %>.size == 0 %>
  Nenhum <%= singular_name %> encontrado
  <br><br>
<%% else %>
  <div id="listagem">
    <table cellspacing="1">
      <thead>
        <tr>
          <th></th>
          <% eval(model_name + '.content_columns').each do |column| -%>
          <th><%= column.human_name  %></th>
          <% end -%>
          <th></th>
          <th></th>
        </tr>
      </thead>

      <tbody>
        <%% alt = true%>
        <%% for <%= singular_name %> in @<%= plural_name %> %>
          <tr>
            <td>
              <%%= link_to image_tag('abrir.png')+ ' Ver dados', :action => 'ver<%= controller_class_name %>', :id => <%= singular_name %>, :page => @<%= singular_name %>_pages.current.to_i %>
            </td>
            <% eval(model_name + '.content_columns').each do |column| -%>
            <td><%%= <%= singular_name %>.<%= column.name %> %></td>
            <% end -%>
            <td>
              <%%= link_to image_tag('editar.png')+ ' Editar', :action => 'editar<%= controller_class_name %>', :id => <%= singular_name %>, :page => @<%= singular_name %>_pages.current.to_i %>
            </td>
            <td>
              <%%= link_to image_tag('remover.png')+ ' Remover', {:action => 'apagar<%= controller_class_name %>', :id => <%= singular_name %>, :page => @<%= singular_name %>_pages.current.to_i}, :confirm => "Tem certeza?" %>
            </td>
          </tr>
        <%% end %>
      </tbody>
        
    </table>
  </div>
<%% end %>

<br />

<strong>Página Atual: </strong><%%= @<%= singular_name %>_pages.current.to_i %>&nbsp;&nbsp;&nbsp;
<%%= link_to '<< Anterior', { :page => @<%= singular_name %>_pages.current.previous } if @<%= singular_name %>_pages.current.previous %>
&nbsp;&nbsp;
<%%= link_to 'Próxima >>', { :page => @<%= singular_name %>_pages.current.next } if @<%= singular_name %>_pages.current.next %> 